<?php


class Favorite_Posts_model extends CI_Model {

    //put your code here
    public $table = "";
    
    function __construct() {
        parent::__construct();
        $this->table = MYSQL_TABLE_PREFLIX.TABLE_USER3_FAVORITE_POSTS;
    }

    function Insert($data){
        $this->db->insert($this->table, $data);
    }
    
    function Delete($data){
        $this->db->delete($this->table, $data);
    }
    
    function Check($data){
        $query = $this->db->get_where($this->table,$data);
        if($query->num_rows){
            return true;
        }
        else{
            return false;
        }
    }
    
    function Get_Num($data){
        return $this->db->where($data)->count_all_results($this->table);
    }
    
    function Get_Advanced($select = '*', $where = array(), $order_by = "", $limit = 10, $offset = 0){
        $query = $this->db->select($select)->order_by($order_by)->get_where($this->table, $where,$limit, $offset);
        return $query->result_array();
    }
}
